package bom.example.common.excel.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author X.I.O
 * @title: ExportTestDatasResp
 * @projectName springboot
 * @description: TODO
 * @date 2021/10/31 13:27
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@HeadRowHeight(value = 15)  //设置表头高度
@ExcelIgnoreUnannotated     //忽略没有注解标记的属性
//@ExcelProperty：如果 value 值相同标题列会合并，index不同不合并
public class ExportTestDatasResp implements Serializable {

    @ExcelProperty(value = "用户姓名", index = 0)
    @ApiModelProperty("用户姓名")
    private String userName;

    @ExcelProperty(value = "地址", index = 1)
    @ApiModelProperty("地址")
    private String address;

    @ExcelProperty(value = "价格", index = 2)
    @NumberFormat(value = "#.00")
    @ApiModelProperty("价格")
    private BigDecimal price;

    @ExcelProperty(value = "状态", index = 3)
    //@FieldConvert(codeType = "status")
    @ApiModelProperty("状态")
    private String status;

    @ExcelProperty(value = "状态名称", index = 4)
    //@FieldConvert(codeType = "status")
    @ApiModelProperty("状态")
    private String statusName;

    @ExcelProperty(value = "创建时间", index = 5)
    @DateTimeFormat(value = "yyyy-MM-dd")
    @ApiModelProperty("创建时间")
    private Date createDate;

    /**
     * 忽略这个字段
     */
    @ExcelIgnore
    private String ignore;


}
